package com.jxc.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/login")
public class login extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().print("这是登录界面");
//        // 请求转发,forward传的参数是req和resp，用的是request的getRequestDispatcher方法
//        req.getRequestDispatcher("/index").forward(req,resp);
        // 响应重定向,里面输入的是完整的地址，用的是response的sendRedirect方法
        resp.sendRedirect("/java_web/index");
    }
}
